/*
 *  Copyright 2001-2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package ar.uba.fi.posgrado.common.dto;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 
 * @author nicolas.gonzalez
 * @see JSONable
 */
@SuppressWarnings("serial")
public class ResponseDTO implements Serializable, JSONable {

    // Si es igual a 0 es ERROR. Caso contrario es OK
    private Integer error;
    private String description;
    
    
    /**
     * @see ar.uba.fi.posgrado.common.dto.JSONable#toJSON()
     */
    public JSONObject toJSON() {
        try {
            JSONObject response = new JSONObject();
            response.put("error", this.error);
            response.put("description", this.description);
            
            return response;
        }
        catch (JSONException e) {
            return new JSONObject();
        }
    }


    /**
     * @return the error
     */
    public Integer getError() {
        return this.error;
    }


    /**
     * @param error the error to set
     */
    public void setError(Integer error) {
        this.error = error;
    }


    /**
     * @return the description
     */
    public String getDescription() {
        return this.description;
    }


    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

}
